package com.qiang.test1;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @package: com.qiang.test1
 * @title: Solution
 * @projectName: burning
 * @description: //TODO
 * @author zhuhongqiang3
 * @date:  2020-08-25 16:11
 * @version: V1.0
 * @retrun com.qiang.test1.burning
 */
public class Solution {



    public int findRepeatNumber(int[] nums) {
        String allStr = "";
        for(int i=0;i< nums.length;i++){
            String cur = String.valueOf(nums[i]);
            if(allStr.indexOf(cur) == 0){
                return Integer.parseInt(cur);
            }
            allStr+=cur+";";
        }
        throw new RuntimeException("不存在");
    }

    public static void main(String[] args) {

//        int[] nums = new int[]{2, 7, 11, 15,3,6};
//        int target = 9;
//        Map<Integer,Integer> map = twoSum(nums, target);
//
//        map.forEach((K,V)->{
//            System.out.println(K+"----"+V);
//        });


        System.out.println(LeetCode.romanToInt("IV"));
    }

    public static boolean isUnique1(String astr) {
        if(astr.length() > 100) return false;
        if(astr.length() < 0) return false;
        Map map = new HashMap<>();
        String[] split = astr.split("");

        for(int i=0;i<split.length;i++){
            if(map.containsKey(split[i])){
                return false;
            }
            map.put(split[i],"");
        }
        return true;
    }


    public boolean isUnique(String astr) {
        if(astr.length() > 100) return false;
        if(astr.length() < 0) return false;
        Map map = new HashMap<>();
        for(int i=0;i<astr.split("").length;i++){
            if(map.containsKey(astr.split("")[i])){
                return true;
            }
            map.put(astr.split("")[i],"");
        }
        return false;
    }

}
